package cn.inbot.shopadmin.module.robot.view;

import android.os.Bundle;
import android.widget.ImageView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;

import org.jetbrains.annotations.Nullable;

import cn.inbot.shopadmin.R;
import cn.inbot.shopadmin.app.RouterParamsKey;
import cn.inbot.shopadmin.app.RouterUrls;
import cn.inbot.shopadmin.bean.UserVo;
import cn.inbot.shopadmin.constant.BaseConstants;
import cn.inbot.lib.framework.annotation.InjectLayout;
import cn.inbot.lib.framework.mvvm.PBActivity;

/**
 * Created by shisenkun on 2021/5/11.
 */

@Route(path = RouterUrls.DEMO_ROBOT_DETAIL)
@InjectLayout(layoutResId = R.layout.activity_robot_detail)
public class RobotDetailActivity extends PBActivity {

    @Autowired(name = RouterParamsKey.USER_VO)
    UserVo userVo;

    private ImageView ivRobotModel;

    @Override
    public void initView(@Nullable Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        immersiveStatusBar(R.color.colorPrimary, true);
    }

    @Override
    protected void onResume() {
        super.onResume();
        setupToolbar(R.id.toolbar, true, true)
                .setTitle(userVo.getRobotSerialNumber());
        setupRobotModelLogo();
    }

    private void setupRobotModelLogo() {
        ivRobotModel = findViewById(R.id.ivRobotModel);
        switch (userVo.getRobotModel()) {
            case BaseConstants.ROBOT_MODEL_P1: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_p1_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_P2: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_p1_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_P3: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_p3_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_T1: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_t1_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_T2: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_t2_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_X1: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_x1_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_X2: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_x2_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_X3: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_x3_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_W1: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_w1_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_W2: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_w2_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_S2: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_s2_bg);
                break;
            }
            case BaseConstants.ROBOT_MODEL_S3: {
                ivRobotModel.setImageResource(R.mipmap.ic_robot_model_s3_bg);
                break;
            }
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}
